package homework;

import java.util.ArrayList;
import java.util.Scanner;

public class number6 {
public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
	System.out.println("请输入第一个数组,用空格分开：");
	String input1 = sc.nextLine();
	int[] arr1 = Change(input1);
	
	System.out.println("请输入第二个数组,用空格分开：");
	String input2 = sc.nextLine();
	int[] arr2 = Change(input2);
	
	ArrayList<Integer> list = new ArrayList<>();
	for(int c:arr1) {
		list.add(c);
	}
	
	for(int c:arr2) {
		if(list.contains(c)) {
			list.remove(list.indexOf(c));
		}else {
			list.add(c);
		}
	}
	
	System.out.println("去重后为："+list);
}


public static int[] Change(String s) {
	String[] inputString = s.split(" ");
	int[] inputint = new int[inputString.length];
	for(int i = 0 ; i < inputString.length ; i++) {
		inputint[i] = Integer.parseInt(inputString[i]);
	}
	return inputint;
}
}
